
import org.easyrules.annotation.Action;
import org.easyrules.annotation.Condition;
import org.easyrules.annotation.Rule;

@Rule(name = "Hello World rule", description = "Say Hello to only duke's friends")
public class HelloWorldRule {

    /**
     * The user input which represents the data that the rule will operate on.
     */
    private String input;

    @Condition
    public boolean checkInput() {
        //The rule should be applied only if the user's response is yes (duke friend)
        return input.equalsIgnoreCase("yes");
    }

    @Action(order = 100)
    public void sayHelloToDukeFriend() throws Exception {
        //When rule conditions are satisfied, prints 'Hello duke's friend!' to the console
        System.out.println("Hello duke's friend!");
    }



    @Action(order = 200)
    public void sayHelloToyuwenrong() throws Exception {
        //When rule conditions are satisfied, prints 'Hello duke's friend!' to the console
        System.out.println("yuwenrong;yuwenrong");
    }

    public void setInput(String input) {
        this.input = input;
    }

}
